
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Seata 提供了哪些分布式事务模式？它们各自的特点是什么 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Seata 提供了哪些分布式事务模式？它们各自的特点是什么 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Seata的AT模式是如何实现事务的自动回滚的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">AT模式在每个数据库操作前会自动生成一个Undo Log。当需要回滚时，Seata会利用这个Undo Log来恢复数据到事务开始前的状态，从而实现自动回滚。</div>
          </div>
          <div class="card-source">来源: 1. AT 模式（Automatic Transaction 模式）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">请解释Seata TCC模式中的三个核心操作（Try, Confirm, Cancel）分别是什么作用？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">TCC模式要求开发者实现三个操作：Try阶段用于预留业务资源；Confirm阶段用于确认并完成业务执行；Cancel阶段则用于在出现问题时取消执行，释放预留的资源。</div>
          </div>
          <div class="card-source">来源: 2. TCC 模式（Try-Confirm-Cancel 模式）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">相较于其他模式，TCC模式在开发上存在什么主要缺点？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">TCC模式的主要缺点是增加了开发的复杂度，因为开发者需要为每个业务操作手动编写Try、Confirm和Cancel三个阶段的具体实现逻辑。</div>
          </div>
          <div class="card-source">来源: 2. TCC 模式（Try-Confirm-Cancel 模式）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">Seata的SAGA模式主要适用于哪种业务场景？它如何处理事务失败的情况？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">SAGA模式主要适用于长事务场景。当某个本地事务失败时，系统会自动调用与已完成的本地事务相对应的补偿操作，以回滚之前的操作。</div>
          </div>
          <div class="card-source">来源: 3. SAGA 模式</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">在实现SAGA模式时，开发者需要重点关注其补偿操作的哪个特性？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在实现SAGA模式时，开发者需要确保补偿操作的幂等性，这是编写补偿逻辑时的一个复杂点。</div>
          </div>
          <div class="card-source">来源: 3. SAGA 模式</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">XA模式在提供严格事务一致性的同时，存在什么显著的缺点？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">XA模式的主要缺点是性能较差，事务的执行时间较长，这通常会导致系统资源的长时间占用。</div>
          </div>
          <div class="card-source">来源: 4. XA 模式</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
